import scrapy
from scrapy_splash import SplashRequest

source = 2

class LagouSpider(scrapy.Spider):
    name = 'lagou'
    allowed_domains = ['www.lagou.com']
    start_urls = ['http://www.lagou.com/']


    def start_requests(self):
        yield SplashRequest(url='https://www.lagou.com/beijing-zhaopin/Java/',
                            args={'wait': 0.5})
    def parse(self, response):
        print('aqie', response.request.headers['User-Agent'], '\n')
        with open("lagou.html", "w") as text_file:
            text_file.write(response.text)
        pass
